# include <bits/stdc++.h>
using namespace std;
int getAnswer(int num1,int num2,int type) {
	if(type==0) {
		return num1&&num2;
	} else if(type==1) {
		return num1||num2;
	} else if(type==2) {
		return (num1==1&&num2==0)||(num1==0&&num2==1);
	}
}
bool isOkay(vector<int> data) {
	int k=0;
	vector<int> level1= {1,0,1,0,1};
	vector<int> level2= {0,0,0,0};
	vector<int> level3= {0,0,0};
	vector<int> level4= {0,0};
	for(int i=0; i<4; ++i) {
		level2[i]=getAnswer(level1[i],level1[i+1],data[k++]);
	}
	for(int i=0; i<3; ++i) {
		level3[i]=getAnswer(level2[i],level2[i+1],data[k++]);
	}
	for(int i=0; i<2; ++i) {
		level4[i]=getAnswer(level3[i],level3[i+1],data[k++]);
	}
	return getAnswer(level4[0],level4[1],data[k++]);
}
int getCount() {
	int result=0;
	for(int k=0; k<81*81*9; ++k) {
		int tmp=k;
		vector<int> data(10,0);
		for(int i=0; i<10; ++i) {
			data[i]=tmp%3;
			tmp=tmp/3;
		}
		cout<<endl;
		if(isOkay(data)) {
			result++;
		}
	}
	return result;
}
int main() {
	cout<<getCount()<<endl;
	return 0;
}
